// same as 

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import java.rmi.RMISecurityManager;

public class RmiServer extends UnicastRemoteObject implements RmiService
{
    public RmiServer(int port) throws RemoteException
    {
        super(port);
    }
 
    public void print(String txt) throws RemoteException
    {
        System.out.println(txt);
    }
 
    public static void main(String[] args)
    {
        //if (System.getSecurityManager() == null)
        //    System.setSecurityManager(new RMISecurityManager());
        try
        {
            Registry rmiRegistry =  LocateRegistry.createRegistry(9999);
            RmiService rmiService = new RmiServer(9999);
            rmiRegistry.bind("RmiService", rmiService);
        }

        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

